package de.unidue.langtech.teaching.pp.example.pipeline;

import org.apache.uima.fit.component.CasDumpWriter;
import org.apache.uima.fit.factory.AnalysisEngineFactory;
import org.apache.uima.fit.factory.CollectionReaderFactory;
import org.apache.uima.fit.pipeline.SimplePipeline;

import de.unidue.langtech.teaching.pp.example.BaselineTaskA;
import de.unidue.langtech.teaching.pp.example.EvaluatorTask;
import de.unidue.langtech.teaching.pp.example.ReaderTaskA;

/**
 * The pipeline runs our program which is separated into reader, baseline and evaluator.
 * By default it reads the development data.
 * It also saves our analysis output to a text file.
 * @author suenme
 *
 */
public class BasicPipelineTaskA
{
	//change input path to "src/test/resources/test/taska-training.txt" for reading training data
    public static void main(String[] args)
        throws Exception
    {
    	System.out.println("Started sentiment analysis for Task A.");
    	double start = System.currentTimeMillis();
    	
        SimplePipeline.runPipeline(
                CollectionReaderFactory.createReader(
                        ReaderTaskA.class,
                        ReaderTaskA.PARAM_INPUT_FILE, "src/test/resources/test/taska-training.txt"
                ),
                AnalysisEngineFactory.createEngineDescription(BaselineTaskA.class),
                AnalysisEngineFactory.createEngineDescription(EvaluatorTask.class),
                AnalysisEngineFactory.createEngineDescription(
                CasDumpWriter.class,
                CasDumpWriter.PARAM_OUTPUT_FILE, "src/test/resources/test/output-taska-training.txt")
                
        	);
        
        double end = System.currentTimeMillis();
        double time = end - start;
        System.out.println("Sentiment analysis took " + time/1000 + " seconds");
    }
}
